<%@include file="/pub/import.jsp"%>
<%@include file="/pub/header.jsp"%>
<%
    int projectId = RequestUtil.getIntParameter(request,"projectId",0);
    int treeId = RequestUtil.getIntParameter(request,"treeId",0);
    Project p = ProjectHandler.getProject(projectId);
    List<ProjectItems> projectItemsList = ProjectItemsHandler.getByProjectIdTreeId(projectId, treeId);
    Map<Integer,ScoreHistory>  hasScoreItemMap = new HashMap<Integer,ScoreHistory>();
    if(projectItemsList!=null && projectItemsList.size()>0) {
	    String projectItemIds = "";
	    for(int i=0; i<projectItemsList.size(); i++) {
	      projectItemIds += projectItemsList.get(i).getId();
	      if(i!=projectItemsList.size()-1) projectItemIds += ","; 
	    }
	    List<ScoreHistory> hasScoreItemList = ScoreHistoryHandler.getByUserIdProjectIdItemIds(projectId,user.getId(),projectItemIds);
	    for(ScoreHistory item: hasScoreItemList) {
	      hasScoreItemMap.put(item.getProjectItemId(),item);
	    }
	  }
	  context.put("hasScoreItemMap", hasScoreItemMap);
    context.put("itemList", projectItemsList);
    context.put("project", p);
    context.put("tree", ScoreTreeHandler.loadById(treeId));
    out.println(TemplateUtil.getOutput(context,"/view/judge/scoreFrame.html"));
%>
<%@include file="/pub/footer.jsp"%>